package com.lanchetech.dao;

import com.lanchetech.bean.request.PageReq;import com.lanchetech.entity.UserCoupon;
import java.util.Date;import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface UserCouponMapper {
    int deleteByPrimaryKey(Long id);

    int insert(UserCoupon record);

    int insertSelective(UserCoupon record);

    UserCoupon selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserCoupon record);

    int updateByPrimaryKey(UserCoupon record);

    int updateBatch(List<UserCoupon> list);

    int updateBatchSelective(List<UserCoupon> list);

    int batchInsert(@Param("list") List<UserCoupon> list);

    List<UserCoupon> findAllByUserIdAndStatusAndNow(@Param("userId") Long userId, @Param("status") Byte status, @Param("now") Date now);

    Long countByUserIdAndStatusAndNow(@Param("userId") Long userId, @Param("status") Byte status, @Param("now") Date now);

    UserCoupon findOneByUserIdAndCouponId(@Param("userId") Long userId, @Param("couponId") Long couponId);

    List<UserCoupon> findAllPage(PageReq req);

    int updateStatusAndUpdatedAtByUserIdAndCouponId(@Param("updatedStatus") Byte updatedStatus, @Param("updatedUpdatedAt") Date updatedUpdatedAt, @Param("userId") Long userId, @Param("couponId") Long couponId);

    List<UserCoupon> findAllByUserIdAndCouponIds(@Param("userId") Long userId, @Param("couponIds") List<Long> couponIds);

    UserCoupon selectOneByCouponId(@Param("couponId") Long couponId);

    List<UserCoupon> findAllByUserId(@Param("userId")Long userId);




}